export default {
  namespaced: true, // 开启命名空间
  state: {
    //收货地址
    defaultAddress: {
      address: "地址",
      deliveryAddressNo: "",
      //购物车数量
    },
    shoppingCartNum: 0,
  },
  getters: {
    getShoppingCartNum(state) {
      return state.shoppingCartNum;
    },
  },
  mutations: {
    setDefaultAddress(state, currentAddress) {
      state.shippingAddress = currentAddress;
    },
    setShoppingCartNum(state, num) {
      state.shoppingCartNum = num;
    },
  },
  actions: {
    updateDefaultAddress({ commit }, currentAddress) {
      commit("setDefaultAddress", currentAddress);
    },
    updateShoppingCartNum({ commit }, num) {
      commit("setShoppingCartNum", num);
    },
  },
};
